import React from "react";
import { createStore } from "./index";

const defaultState = {
  user: { name: "frank", age: 18 },
  group: "前端组",
};

const reducer = (state, { type, payload }) => {
  if (type == "updateUser") {
    return {
      ...state,
      user: {
        ...state.user,
        ...payload,
      },
    };
  } else {
    return state;
  }
};

const store = createStore(defaultState, reducer);

export default store;
